/*------------------------------------------------------------------------------
 * PROJ : Prototype
 * NAME : sculove.spring.framework.util.RequestUtil.java
 *        
 * Copyright 2009 sculove All rights reserved
 *------------------------------------------------------------------------------
*/
package sculove.spring.framework.util;

import javax.servlet.http.HttpServletRequest;

/**
 * <pre>
 * sculove.spring.framework.util.RequestUtil.java
 * TODO
 * 
 * </pre>
 * @date : 2009. 12. 4. 오전 10:40:54
 * @version :
 * @author : sculove
 */
public class RequestUtil {
	/**
	 * 파라미터값 반환
	 * @param request
	 * @param paramName
	 * @param defaultValue
	 * @return
	 */
	public static String getParamValue(HttpServletRequest request, String paramName, String defaultValue)
	{
	    String paramValue = defaultValue ;
	    try{
	        if( request.getParameter( paramName )== null ){
	            paramValue = defaultValue ;
	        }else{

	            paramValue = (String)request.getParameter( paramName );
	        }
	    }catch(Exception e){

	    }
	    return paramValue;
	}
	
	public static String getParamValue(HttpServletRequest request, String paramName) {
		return RequestUtil.getParamValue(request, paramName, "");
	}

//	/**
//	 * request 객체의 모든 파라미터 얻기
//	 * @param request
//	 * @return
//	 */
//	public static Hashtable getParams(HttpServletRequest request, JspWriter out) throws Exception{
//			Hashtable   map  = new Hashtable();
//			Enumeration iter;
//			String    name  = "";
//			String    value = "";
//
//			out.println("[GET]");
//			for( iter = request.getParameterNames() ; iter.hasMoreElements() ; ) {
//			    name = iter.nextElement().toString();
//			    value = getParamValue(request, name, "");
//
//			    map.put( name.trim(), new String(value.trim()) );
//			    out.println("<BR>- name : " + name + ", value : " + value);
//			}
//			return map;
//	}
	

}
